package com.qixiucoding.strategy.impl;

import com.alibaba.fastjson.JSONObject;
import com.qixiucoding.link.AbstractLink;
import com.qixiucoding.link.inherit.StratLink;
import com.qixiucoding.link.inherit.dao.Dao1Inherit;
import com.qixiucoding.link.inherit.dao.Dao2Inherit;
import com.qixiucoding.link.inherit.dao.Dao3Inherit;
import com.qixiucoding.link.inherit.field.FieldF1Inherit;
import com.qixiucoding.link.inherit.field.FieldF2Inherit;
import com.qixiucoding.strategy.IStrategy;
import com.qixiucoding.strategy.StrategyName;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Author longhj
 * @Description TODO
 * @Date 2021/10/24 星期日 17:58
 */
@Component
@StrategyName(strategyName = "B策略")
public class BStrategy implements IStrategy {
    @Autowired
    private FieldF1Inherit fieldF1Inherit;
    @Autowired
    private Dao1Inherit dao1Inherit;
    @Autowired
    private Dao2Inherit dao2Inherit;
    @Autowired
    private Dao3Inherit dao3Inherit;

    @Override
    public JSONObject dealData(JSONObject jsonObject) {
        // AbstractLink abstractLink = fieldF2Inherit.appendNext(dao2Inherit.appendNext(dao1Inherit.appendNext(dao3Inherit)));
        fieldF1Inherit.appendNext(dao1Inherit).appendNext(dao2Inherit).appendNext(dao3Inherit);
        JSONObject result = new StratLink().start(jsonObject, fieldF1Inherit);
        return result;
    }
}
